package com.bj58.wuxian.lucene.utils;

import redis.clients.jedis.Jedis;

public class RedisUtil {

	private static Jedis jedis = null;
	static {
		jedis = new Jedis("127.0.0.1", 6379);

	}

	public static long incr(String key) {
		return jedis.incr(key);
	}

	public static long decr(String key) {
		return jedis.decr(key);
	}

	public static void set(String key, String value) {
		jedis.set(key, value);
	}

	public static String get(String key) {
		return jedis.get(key);
	}

	public static String flushAll() {
		return jedis.flushAll();
	}

	public static void main(String[] args) {
//		flushAll();
//		try {
//			String rootPath=RedisUtil.class.getResource("/").getPath();
//			List<String> list=FileUtils.readLines(new File(rootPath+"/sougou.txt"), "utf-8");
//			for (Iterator iterator = list.iterator(); iterator.hasNext();) {
//				String string = (String) iterator.next();
//				String [] arr=string.split(" ");
//				RedisUtil.set(arr[0].substring(1), arr[1]);
//			}
//			System.out.println("***********************");
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		System.out.println(RedisUtil.get("zuo'yong"));
		
	}

}
